package com.sx.manage.controller.consumer.person;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sx.manage.controller.base.MBaseController;
import com.sx.manage.service.consumer.feedback.MFeedBackWebService;
import com.sx.manage.servlet.ViewAndModel;
import com.sx.model.manage.mybatis.form.consumer.feedback.MConsumerFeedbackForm;
import com.sx.model.manage.mybatis.vo.consumer.feedback.MConsumerFeedbackVO;
import com.sx.model.manage.mybatis.vo.result.ResultBooleanVO;
import com.sx.model.manage.mybatis.vo.result.ResultListVO;

/**
 * 用户反馈 controller
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/feedback")
public class MFeedBackController extends MBaseController{
	private Logger log = LoggerFactory.getLogger(this.getClass());
	
	@Resource(name="feedBackWebService")
	private MFeedBackWebService feedBackWebService;
	
	/**
	 * 跳转到 列表界面
	 */
	@RequestMapping(value = "individualFeedBack")
	public ViewAndModel consumerview() {
		log.debug("用户反馈界面跳转");
		ViewAndModel model = new ViewAndModel(request, cache);
		model.setViewName("consumer/personal/feedback/individualFeedback");
		return model;
	}
	/**
	 * 跳转到 列表界面
	 */
	@RequestMapping(value = "page/viewFeedBack")
	public ViewAndModel viewFeedBack(MConsumerFeedbackForm form) {
		log.debug("用户反馈界面跳转form={}",form);
		return feedBackWebService.viewFeedBack(form, new ViewAndModel(request, cache));
	}
	/** 获取用户反馈分页信息 */
	@RequestMapping(value = "page")
	@ResponseBody
	public ResultListVO<MConsumerFeedbackVO> page(MConsumerFeedbackForm form) {
		log.debug(" 用户反馈界面跳转数据查询form={}",form);
		return feedBackWebService.queryPage(form);
	}
	/** 用户反馈标记为已读*/
	@RequestMapping(value = "page/signRead")
	@ResponseBody
	public ResultBooleanVO signRead(MConsumerFeedbackForm form) {
		log.debug("用户反馈标记为已读 form={}",form);
		return feedBackWebService.signRead(form, this.loginConsumer());
		
	}
}
